﻿using Android.Content;

namespace Cinemacenter.Droid
{
	public class SharedPreferenceManager
	{
		readonly Context context;
		readonly SettingsKey<long> marqueeTsvtPreference;
		readonly SettingsKey<long> upcomingTsvtPreference;
		readonly SettingsKey<long> citiesTsvtPreference;
		readonly SettingsKey<int> cityId;

		public SharedPreferenceManager (Context context)
		{
			this.context = context;
			marqueeTsvtPreference = new SettingsKey<long> ("com.ldb.marquecine", "marquee_tsvt", long.MinValue); 
			upcomingTsvtPreference = new SettingsKey<long> ("com.ldb.marquecine", "upcoming_movies_tsvt", long.MinValue);
			citiesTsvtPreference = new SettingsKey<long> ("com.ldb.marquecine", "cities_tsvt", long.MinValue);
			cityId = new SettingsKey<int> ("com.ldb.marquecine", "city_id", -1);
		}

		public long MarqueeTsvtPreference {
			get{ return marqueeTsvtPreference.GetSetting (context); }
			set{ marqueeTsvtPreference.SetSetting (context, value); }
		}

		public long UpcomingTsvtPreference {
			get{ return upcomingTsvtPreference.GetSetting (context); }
			set{ upcomingTsvtPreference.SetSetting (context, value); }
		}

		public long CitiesTsvtPreference {
			get{ return citiesTsvtPreference.GetSetting (context); }
			set{ citiesTsvtPreference.SetSetting (context, value); }
		}

		public int CityId {
			get{ return cityId.GetSetting (context); }
			set{ cityId.SetSetting (context, value); }
		}
	}
}
